/**
 *
 */
package gemini.basic.dao.impl;

import gemini.basic.dao.AddressDao;
import gemini.basic.dao.GmnDao;
import gemini.basic.model.Address;

import org.springframework.orm.hibernate3.support.HibernateDaoSupport;

/**
 *
 *
 */
public class AddressDaoImpl extends HibernateDaoSupport implements AddressDao {

	private GmnDao gmnDao;

	public void setGmnDao(GmnDao gmnDao) {
		this.gmnDao = gmnDao;
	}

	@Override
	public Address saveOrUpdate(Address address, boolean flush) {
		Address result = null;
		if (flush) {
			result = (Address) gmnDao.saveOrUpdateAndFlush(address);
		} else {
			result = (Address) gmnDao.saveOrUpdate(address);
		}
		return result;
	}

	@Override
	public Address getById(int id) {
		Address result = getHibernateTemplate().get(Address.class, id);
		return result;
	}

}
